<div id="login" align="center">
<form name="login.form" autocomplete="off" onsubmit="return false;">
<table width="400px" height="100px">
	<tr>
		<td>用户名</td>
		<td><input id="username" type="text" name="username" maxlength="20" style="width:100px;border:1px #404040 solid;font-size:9pt;padding:2px 0px 2px 5px;" onmouseover="this.focus()" onfocus="this.select()" value="" /></td>
	</tr>
	<tr>
		<td>密码</td>
		<td><input id="password" type="password" name="password" style="width:100px;border:1px #404040 solid;font-size:9pt;padding:2px 0px 2px 5px;" onmouseover="this.focus()" onfocus="this.select()" value="" /></td>
	</tr>
	<tr collspan="2">
		<td width="78px" height="30px"><input name="blogin" id="blogin" type="button" value="" style="width:75px;height:25px;background:url(images/07.gif) no-repeat;border:0px;cursor:pointer;font-size:12px;" /><div id="logining"></div></td>	
	</tr>
	
</table>
</form>
</div>

<script>
//登录检测
applicationLogin = function(){

	var url = '/auth/checkuser.action';
	
	var usernameValue = $('username').get('value'); 
	var passwordValue = $('password').get('value'); 
	
	if (usernameValue == '' || passwordValue ==''){
		MUI.notification('<font color=red>错误：</font>用户名或口令不能为空！');
		return;
	}
	$('blogin').setStyle('display','none');
	$('logining').innerHTML='<img src="images/spinner.gif" width="16px" height="16px">';
	
	try {
	var request = new Request.JSON({
		url: url,
		onComplete: function(json,text) {
			if (json.login==1){// 正确登录
				//alert(json.login);
			   applicationPage();//应用工作主界面
			}else{
			   $('logining').innerHTML='';
			   MUI.notification('<font color=red>错误：</font>用户名或口令错误，请重新输入！');
			   $('blogin').setStyle('display','block');
			}
		}
	}).get({"username":usernameValue,"password":passwordValue});
	} catch (ex) {
		$('logining').innerHTML='';
		MUI.notification('<font color=red>错误：</font>访问失败('+ex.message+')');
		$('blogin').setStyle('display','block');
	}

}

	if ($('blogin')){
		$('blogin').addEvent('click', function(e) {
			new Event(e).stop();
			applicationLogin();
		});
	}

	//监听按键
	if ($('desktop')){
		$('desktop').removeEvents();
		$('desktop').addEvent('keydown', function(e) {
			if (e.key == 'enter') applicationLogin();
		});
	}
	
    window.addEvent('domready', function() {

    });
</script> 